package com.ww.design.pattern.strategy;

import lombok.Getter;
import lombok.Setter;

@Setter
@Getter
public class MovieTicket {

    private double price;
    
    private String type;
    
    public double getPrice() {
        return calculate();
    }
    
    public double calculate() {
        if (type.equalsIgnoreCase("student")) {
            System.out.println("学生票：");
            return price * 0.8;
        } else if (type.equalsIgnoreCase("children") && price >= 20) {
            System.out.println("儿童票：");
            return price - 10;
        } else if (type.equalsIgnoreCase("vip")) {
            System.out.println("VIP票：");
            System.out.println("增加积分！");
            return price * 0.5;
        } else {
            return price;
        }
    }

	public String getType() {
		return type;
	}

	public void setType(String type) {
		this.type = type;
	}

	public void setPrice(double price) {
		this.price = price;
	}
}
